﻿<div ng-controller="IpAuthenticationDetailsController as ctrl">

    <p>{{ctrl.accountInfo.accountName}}</p>
    <form name="frmIpSubmit">
        <div ng-repeat="data in ctrl.accountInfo.ipDatas">
            <ng-form name="frmIp">
                Ip From
                <input ng-model="data.ipFrom" name="ipFrom"
                       ng-pattern='/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/' required/>
                <span ng-show="frmIp.ipFrom.$error.pattern">Invalid ip error</span>
                <span ng-show="frmIp.ipFrom.$error.required">The initial ip adress is required!</span>
                Ip To
                <input name="ipTo" ng-model="data.ipTo"
                       ng-pattern='/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/' />
                <span ng-show="frmIp.ipTo.$error.pattern">Invalid ip error</span>
                <input type="submit" value="-" ng-click="ctrl.remove($index)" />
            </ng-form>
        </div>

        <br />
        <!--<a ng-click="ctrl.addRecord()">+</a>-->
        <input type="submit" value="+" ng-click="ctrl.addRecord()" />
        <input type="submit" value="Save" ng-click="ctrl.saveData()" ng-show="!frmIpSubmit.$invalid" />
        <input type="submit" value="Cancel" ng-click="ctrl.cancelModification()" />
        <span ng-show="frmIpSubmit.$invalid">
            Can not save because there ip data entry is invalid!
        </span>
    </form>
</div>
